﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLBenhVien
{
    public partial class frmManHinhChinh : Form
    {
        public static DBOUser current_user;
        public frmManHinhChinh(DBOUser u)
        {
            InitializeComponent();
            current_user = u;
        }

        private void smThoat_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void quảnLýKhámBệnhToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmTiepNhanBenh t = new frmTiepNhanBenh();
            t.MdiParent = this;
            t.Show();
        }

        private void quảnLýBệnhNhânToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmKhamBenh k = new frmKhamBenh();
            k.MdiParent = this;
            k.Show();
        }

        private void frmManHinhChinh_Load(object sender, EventArgs e)
        {
            tsDate.Text = "Người đang đăng nhập: " + current_user.fullname + " Ngày: " + DateTime.Now.ToShortDateString();
            switch (current_user.usertype)
            {
                case DBOUser.User_Type.Admin:
                    tsQLBenhNhan.Visible = false;
                    tsQLThuoc.Visible = false;
                    tsQLKhamBenh.Visible = false;
                    tsThuNgan.Visible = false;
                    tsXetNghiem.Visible = false;
                    tsTTTienThuoc.Visible = false;
                    break;
                case DBOUser.User_Type.BacSi:
                    tsQLBenhNhan.Visible = false;
                    tsQLThuoc.Visible = false;
                    tsQLUser.Visible = false;
                    tsThuNgan.Visible = false;
                    tsXetNghiem.Visible = false;
                    tsTTTienThuoc.Visible = false;
                    break;
                case DBOUser.User_Type.Thuoc:
                    tsQLBenhNhan.Visible = false;
                    tsQLKhamBenh.Visible = false;
                    tsQLUser.Visible = false;
                    tsThuNgan.Visible = false;
                    tsXetNghiem.Visible = false;
                    
                    break;
                case DBOUser.User_Type.ThuNgan:
                    tsQLKhamBenh.Visible = false;
                    tsQLThuoc.Visible = false;
                    tsQLUser.Visible = false;
                    tsXetNghiem.Visible = false;
                    
                    break;
                case DBOUser.User_Type.TiepTan:
                    tsQLKhamBenh.Visible = false;
                    tsQLThuoc.Visible = false;
                    tsQLUser.Visible = false;
                    tsThuNgan.Visible = false;
                    tsXetNghiem.Visible = false;
                    tsTTTienThuoc.Visible = false;
                    break;
                case DBOUser.User_Type.XetNghiem:
                    tsQLKhamBenh.Visible = false;
                    tsQLThuoc.Visible = false;
                    tsQLUser.Visible = false;
                    tsThuNgan.Visible = false;
                    tsQLBenhNhan.Visible = false;
                    tsTTTienThuoc.Visible = false;
                    break;
                default:
                    break;
            }            
        }

        private void quanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmQuanLyUser qlu = new frmQuanLyUser();
            qlu.MdiParent = this;
            qlu.Show();
        }

        private void tsTTTienThuoc_Click(object sender, EventArgs e)
        {
            frmThanhToanTienThuoc frmtttt = new frmThanhToanTienThuoc();
            frmtttt.MdiParent = this;
            frmtttt.Show();
        }

        private void báoCáoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmBaoCao bc = new frmBaoCao();
            bc.MdiParent = this;
            bc.Show();
        }
    }
}
